//
//  StatusTextView.swift
//  微博项目
//
//  Created by zhang on 16/3/13.
//  Copyright © 2016年 jin. All rights reserved.
//

import UIKit

class StatusTextView: UITextView {

    /*
    // Only override drawRect: if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func drawRect(rect: CGRect) {
        // Drawing code
    }
    */
    var placeholderText:String?
        {
        didSet
        {
            self.placeholderLabel?.text = self.placeholderText
        }
    }
    weak var placeholderLabel:UILabel?
    override init(frame: CGRect, textContainer: NSTextContainer?) {
        super.init(frame: frame, textContainer: textContainer)
        self.font = UIFont.systemFontOfSize(15)
        self.contentSize = CGSizeMake(self.contentSize.width, self.contentSize.height)
        self.alwaysBounceHorizontal = false
        // 默认是不允许垂直拖的
        self.alwaysBounceVertical = true
        //        textView.bounces = false
        
        let placeholderLabel = UILabel()
        placeholderLabel.font = self.font
        placeholderLabel.text = "说点什么吧。。。。"
        placeholderLabel.sizeToFit()
        placeholderLabel.frame = CGRectMake(5, 8, placeholderLabel.bounds.size.width, placeholderLabel.bounds.size.height)
        self.addSubview(placeholderLabel)
        self.placeholderLabel = placeholderLabel
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}
